package twelfth.打印流;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintStream;

public class 使用PrintStream输出 {
    public static void main(String[] args) throws FileNotFoundException {
        String path = "D:" + File.separator + "WorkSpaces" + File.separator + "JavaDevelopBase_start_329" + File.separator + "src" + File.separator + "twelfth" + File.separator + "PrintStream.txt";
        File f = new File(path);
        // 通过FileOutputStream实例化，意味着所有的输出是向文件中打印
        PrintStream ps = new PrintStream(new FileOutputStream(f));
        ps.print("你好");
        ps.println("技术大佬");
        ps.print("1+1="+2);
        ps.close();
    }
}
